# 面向对象-继承
class a():
    def __init__(self):
        self.num=1
    def info(self):
        print(self.num)
class b(a):
    pass
re=b()
re.info()

# 单继承
class master():
    def __init__(self):
        self.kongfu='五香煎饼'
    def make(self):
        print(f'运用{self.kongfu}制作了煎饼')
#调用父类方法
class prenticce(master):
    pass
# 实力化子类
xiaoming=prenticce()
print(xiaoming.kongfu)
xiaoming.make()

# 多继承
class master():
    def __init__(self):
        self.kongfu='五香煎饼'
    def make(self):
        print(f'运用{self.kongfu}制作了煎饼')

# 创建学校类
class schllo():
    def __init__(self):
        self.kongfu='香辣煎饼'
    def make(self):
        print(f'运用{self.kongfu}制作了煎饼')
# 子类调用两父类

class prentice(schllo,master):
    pass
# 子类实力化
xiaoming=prenticce()
print(xiaoming.kongfu)
xiaoming.make()

# 子类重写父类同名方法和属性
class master():
    def __init__(self):
        self.kongfu='五香煎饼'
    def make(self):
        print(f'运用{self.kongfu}制作了煎饼')

# 创建学校类
class schllo():
    def __init__(self):
        self.kongfu='香辣煎饼'
    def make(self):
        print(f'运用{self.kongfu}制作了煎饼')

# 独创佩服
class prentice(schllo,master):
    def __init__(self):
        self.kongfu='独创煎饼果子'
    def make(self):
        print(f'运用{self.kongfu}制作了煎饼')

# 创建实力化
xiaoming=prentice()
print(xiaoming.kongfu)
xiaoming.make()


# 子类调用父类同名方法和属性
class master():
    def __init__(self):
        self.kongfu='五香煎饼'
    def make(self):
        print(f'运用{self.kongfu}制作了煎饼')

# 创建学校类
class schllo():
    def __init__(self):
        self.kongfu='香辣煎饼'
    def make(self):
        print(f'运用{self.kongfu}制作了煎饼')

# 独创
class prentice(schllo,master):
    def __init__(self):
        self.kongfu='独创煎饼果子'
    def make(self):
        # 调用父类方法，需要先调用用自己的方法
        self.__init__()
        print(f'运用{self.kongfu}制作了煎饼')

    def make_cake(self):
        master.__init__(self)
        master.make(self)

    def make_cake1(self):
        schllo.__init__(self)
        schllo.make(self)

# 多层继承
class tusun(prentice):
    pass

# xiaoming=prentice()
# xiaoming.make_cake()
# xiaoming.make()
# xiaoming.make_cake1()

# 徒孙调用
xiaoxiao=tusun()
xiaoxiao.make()
xiaoxiao.make_cake()
xiaoxiao.make_cake1()


# super()函数

class master():
    def __init__(self):
        self.kongfu='五香煎饼'
    def make(self):
        print(f'运用{self.kongfu}制作了煎饼')

# 创建学校类
class schllo():
    def __init__(self):
        self.kongfu='香辣煎饼'
    def make(self):
        print(f'运用{self.kongfu}制作了煎饼')

# 独创
class prentice(schllo,master):
    def __init__(self):
        self.kongfu='独创煎饼果子123'
    def make(self):
        # 调用父类方法，需要先调用用自己的方法
        self.__init__()
        print(f'运用{self.kongfu}制作了煎饼')

    def make_cake(self):
        master.__init__(self)
        master.make(self)

    def make_cake1(self):
        schllo.__init__(self)
        schllo.make(self)
    def make_old_cake(self):
        super().__init__()
        super().make()
        super().make_cake()
        super().make.cake1()

xiaol=prentice()
xiaol.make()
xiaol.make_cake()
xiaol.make_cake1()


# 私有权限
class master():
    def __init__(self):
        self.kongfu='五香煎饼44'
        self.__money=100
    def make(self):
        print(f'运用{self.kongfu}制作了煎饼---')
#     私有方法
    def __info(self):
        print(self.kongfu)
        print(self.__money)
    #     获取私有属性
    def get_money(self):
        return self.__money
#     修改私有属性
    def set__money(self):
        self.__money=500
#

class perad(master):
    pass

xiaomimg=perad()
print(xiaomimg.get_money())
xiaomimg.set__money()
print(xiaomimg.get_money())

# 多态
class dog():
    def work(self):
        print('走你')
class armydog(dog):
    def work(self):
        print('追人')
class drugdog(dog):
    def work(self):
        print('毒品')
class person():
    def work_dog(self,dog):
        dog.work()
ad=armydog()
dd=drugdog()
saqiu=person()
saqiu.work_dog(ad)
saqiu.work_dog(dd)

#类属性
class dog():
    tooth=10
wangcai=dog()
xiaohei=dog()

# 修改类属性
dog.tooth=30
# 通过类对象修改，其实是创建两一个实力对象
wangcai.tooth=44
print(dog.tooth)
print(wangcai.tooth)
print(xiaohei.tooth)

# 类方法
class dog():
    __tooyh=109
    @classmethod
    def get_tooth(cls):
        return cls.__tooyh
wangcai=dog()
wq=wangcai.get_tooth()
print(wq)


#静态方法
class dog():
    @staticmethod
    def info_print():
        print('这是一个恶狗类')
wangcai=dog()
wangcai.info_print()
dog.info_print()